package com.linjuke.beginsum.web.modules.screen.json;

import com.linjuke.beginsum.biz.ao.BeginsumAO;
import com.linjuke.beginsum.web.common.MobileBaseScreen;
import com.linjuke.water.common.services.query.UserItemQuery;
import com.zjuh.splist.web.RunData;
import com.zjuh.splist.web.TemplateContext;
import com.zjuh.sweet.result.Result;

public class UserItems extends MobileBaseScreen {

	private BeginsumAO beginsumAO;
	
	private int pageSize = 5;
	
	@Override
	public void executeImplement(RunData rundata, TemplateContext templateContext) {
		int page = rundata.getQueryString().getInt("page", 1);
		UserItemQuery userItemQuery = new UserItemQuery();
		userItemQuery.setPageNo(page);
		userItemQuery.setPageSize(pageSize);
		Result result = beginsumAO.userItemsList(userItemQuery);
		if (result.isSuccess()) {
			this.result2Context(result, templateContext);
		} else {
			this.handleErrorJson(result, rundata, templateContext);
		}
	}

	public void setBeginsumAO(BeginsumAO beginsumAO) {
		this.beginsumAO = beginsumAO;
	}

}
